Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reach/observe-rect

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/observe-rect

Observe the Rect of a DOM element.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
488K
decreased by-2.18%
Maintainers
4
Weekly downloads
 
Created

What is @reach/observe-rect?

@reach/observe-rect is a utility for observing changes to the size and position of a DOM element. It provides a simple API to track the dimensions and position of an element, which can be useful for responsive design, animations, and other dynamic UI updates.

What are @reach/observe-rect's main functionalities?

Observe changes to an element's size and position

This feature allows you to observe changes to the size and position of a DOM element. The `observeRect` function takes an element and a callback function that receives the new rect object whenever the element's size or position changes. The `unobserve` function can be called to stop observing.

const { observeRect } = require('@reach/observe-rect');

const element = document.getElementById('my-element');

const unobserve = observeRect(element, (rect) => {
  console.log('Element rect:', rect);
});

// To stop observing
unobserve();

Other packages similar to @reach/observe-rect

FAQs

Package last updated on 22 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc